// 需求类型
export const CHANNEL_ENUM = [
  {
    key: "AL",
    code: 1,
    desc: "阿里",
  },
  {
    key: "JD",
    code: 2,
    desc: "京东",
  },
  {
    key: "DOUYIN",
    code: 3,
    desc: "抖音",
  },
];
// 执行状态
export const EXECUTE_STATE_ENUM = [
  {
    key: "b",
    code: 1,
    desc: "执行成功",
  },
  {
    key: "c",
    code: 2,
    desc: "执行失败",
  },
  {
    key: "d",
    code: 3,
    desc: "执行中",
  },
  {
    key: "e",
    code: 4,
    desc: "待执行",
  },
];

// 枚举转化为Options
export const generationOptions = (arr: any = [], key = 'key') => {
  return arr.map((r: any) => {
    return {
      value: `${r[key]}`,
      label: r.desc,
    }
  })
}
// 获取枚举文案
export const getEnumsDesc = (targets: Array<any>, key: string, value: string) => {
  const arr: any = targets.filter((r: any) => r.key === key);
  const desc: any = arr[0][value];
  return desc;
}